shorthand: Initialize unparsed values
authorBenjamin Otte <otte@redhat.com>
Mon, 2 Jan 2012 03:11:20 +0000 (04:11 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 9 Jan 2012 17:37:54 +0000 (18:37 +0100)
All values that the parse funcs didn't parse are initialized to
'initial'.

gtk/gtkcssshorthandproperty.c

index 79fb1d24f040ad8be67ec631c58b65789afd1f25..5d86e54ac798e2140c7592a87ecaef8e3d908c91 100644 (file)
@@ -141,6 +141,18 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
       return FALSE;
     }
 
+  /* All values that aren't set by the parse func are set to their
+   * default values here.
+   * XXX: Is the default always initial or can it be inherit? */
+  for (i = 0; i < shorthand->subproperties->len; i++)
+    {
+      GValue *val = g_value_array_get_nth (array, i);
+      if (G_IS_VALUE (val))
+        continue;
+      g_value_init (val, GTK_TYPE_CSS_SPECIAL_VALUE);
+      g_value_set_enum (val, GTK_CSS_INITIAL);
+    }
+
   g_value_unset (value);
   g_value_init (value, G_TYPE_VALUE_ARRAY);
   g_value_set_boxed (value, array);